//
//  TextBox.h
//  AHTest
//
//  Created by ash on 16/8/2.
//  Copyright © 2016年 ash. All rights reserved.
//  文本框

#import <UIKit/UIKit.h>

/**
 *  要是用非 arc。。。。。。／／     -fno-objc-arc
 */
/** textContainerInset和placeHolderRect根据需要调整 然后setNeedsDisplay*/
@interface PHTextView : UITextView
{
    NSInteger currentLine;//文本的行数
}
/**
 *  标语文本
 */
@property(nonatomic,retain)NSString *placeholder;
/**
 *  标语文本的颜色
 */
@property (nonatomic, strong) UIColor *placeholderColor;

@property(strong,nonatomic) UIFont *placeholderFont;
/**是否计数*/
@property (nonatomic, assign) BOOL showCount;
/**
 *  设置最大行数
 */
@property (nonatomic, assign) NSInteger maxLines;
//占位符居中
@property (nonatomic, assign) BOOL isMiddlePlaceholder;
@property(nonatomic,assign,readonly)NSInteger textLines;
@property (nonatomic,assign) CGRect placeHolderRect;
/**
 *  标语文本的偏移量
 */
//@property (nonatomic, assign) UIEdgeInsets textInsets;
/**行数改变了的通知*/
@property(nonatomic,copy) void(^changeLineBlock)(NSInteger lines);
@end


typedef NS_ENUM(NSUInteger,TextBoxType){
    TextViewBox = 1,
    TextFieldBox
};
@interface TextBox : UIView

/** 初始化指定最大字数 如果 maxNumber <= 0 表示无限制 **/
//- (instancetype)initWithMaxNumber:(NSInteger)maxNumber;
@property (nonatomic, assign) NSInteger maxNumber;
/** 是否可编辑 **/
@property (nonatomic, assign) BOOL isEditable;
@property (nonatomic, strong) PHTextView *textView;
@property (nonatomic, strong) UITextField *textField;
/**文本类型*/
@property (nonatomic, assign) TextBoxType textBoxType;
/**是否计数*/
@property (nonatomic, assign) BOOL showCount;
/**计数标签*/
@property (nonatomic, strong) UILabel *lbLimit;
@property (nonatomic, strong,readonly) NSString *text;
@property(nonatomic,copy) void(^textDidChangeBlock)(TextBox *textBox);
@end

